import numpy as np
class Scaller(object):
    def __init__(self) -> None:
        self.avg = 0
        self.value = 0
        self.iter_num = 0
        self.sum = 0

    def update(self, value):
        self.value = value
        self.iter_num += 1
        self.sum = self.sum+value
        self.avg = self.sum/self.iter_num

    def reset(self):
        self.avg = 0
        self.value = 0
        self.iter_num = 0
        self.sum = 0

class Recorder(object):

    def __init__(self) -> None:
        self.value = []

    def update(self, v):
        self.value.append(v)
    
    def reset(self):
        self.value.clear()

    def __call__(self):
        result = np.concatenate(self.value, axis=0)
        return result